// hyb_yl/mycenter/pages/extenPatient/extenPatient.js
var app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    tabindex: 0,
    patientlist: [{}, {}, {}]
  },
  tabindex: function (e) {
    var that = this
    var id = that.data.id
    const index = e.currentTarget.dataset.index;
    if (index == 0) {
      app.util.request({
        'url': 'entry/wxapp/tuike.leverperson',
        data: {
          id: id,
          index: index
        },
        success: function (res) {
          console.log(res)
          that.setData({
            list: res.data.list,
            count: res.data.count,
            count1:res.data.count1,
            count2: res.data.count2,
            num:res.data.count1+res.data.count2
          })
        }
      })
    } else {
      app.util.request({
        'url': 'entry/wxapp/tuike.leverpersontwo',
        data: {
          id: id,
          index: index
        },
        success: function (res) {
          console.log(res)
          that.setData({
            list: res.data.list,
            count: res.data.count,
            count1:res.data.count1,
            count2: res.data.count2,
            num:res.data.count1+res.data.count2
          })
        }
      })
    }

    this.setData({
      tabindex: index
    })
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    //查询我的一级二级分销
    var that = this
    var id = options.id
    app.util.request({
      'url': 'entry/wxapp/tuike.leverperson',
      data: {
        id: id,
        index: 0
      },
      success: function (res) {
        console.log(res)
        that.setData({
          list: res.data.list,
          count: res.data.count,
          count1: res.data.count1,
          count2: res.data.count2,
          num:res.data.count1+res.data.count2
        })
      }
    })
    that.setData({
      id: id
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})